/*
 * @Author: your name
 * @Date: 2022-02-21 09:44:31
 * @LastEditTime: 2022-02-21 09:52:55
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /zxd/dome_vue/src/utils/filterRouter.js
 */

/**
 * @description: 筛选路由
 * @param {用户权限} author
 * @param {所有路由} routerList
 * @return {*}
 */
 export const fuilterRouter = (routerList, author) => {
    const router = routerList.filter(item => item.meta.author.indexOf(author) !== -1);

    router.length && router.forEach(item => {
        
        if(item.children) {
            item.children = fuilterRouter(item.children, author);
        }
    })

    return router;
}